<?php
class Administrator_home_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
	
	/*Hilight Update*/
	function hilight_update()
	{
		$home_hilight = $this->input->post('home_hilight');
		$this->db->update('module_page',array('json' => json_encode($home_hilight)),array('page' => 'home'));
	}
	
	function intrend_update()
	{
		$intrend_module_arr = $this->input->post('intrend_module');
		$intrend_id_arr = $this->input->post('intrend_id');
		$data = array();
		if(!empty($intrend_id_arr)) foreach($intrend_id_arr as $key => $value):
			$data[] = array(
				'module' => $intrend_module_arr[$key],
				'value' => $value
			);
		endforeach;
		if(!empty($data)) $this->db->update('module_page',array('json' => json_encode($data)),array('page' => 'home_intrend'));
		
		//Clear Memcache
		$this->memcache->delete('dataHomeIntrend');
	}
	
	/*Career Update*/
	function career_update()
	{
		$home_career = $this->input->post('home_career');
		$this->db->update('module_page',array('text' => $home_career),array('page' => 'career'));	
	}	
}

?>